'''
Created on 22.01.2013

@author: aska
'''
import ctypes
#from OpenGL.GLUT.freeglut import c_int
#door_control_dll_inst = 0
#global door_control_dll_inst
class Door_control_dll_interface(object):
    '''
    classdocs
    '''
    #func_door_control_get_sum_inst = ctypes.WINFUNCTYPE(ctypes.c_int)
    #global door_control_dll_inst
    #door_control_dll_inst = ctypes.WinDLL()
    #global door_control_dll_inst
    def __init__(self):
        '''
        Constructor
        '''
        #door_control_dll_inst = ctypes.WinDLL("../Door_control_dll/Release/Door_control_dll.dll")
        #door_control_dll_inst = ctypes.WinDLL("Door_control_dll.dll")
        #dll_func_sum = ctypes.WINFUNCTYPE (ctypes.c_int,ctypes.c_int, ctypes.c_voidp)
        #print ctypes.windll.Door_control_dll.door_control_get_sum
        #func_door_control_get_sum_inst = ctypes.windll.door_control_dll_inst.door_control_get_sum(4, 4, ctypes.byref(var_int))
        #print ' func_door_control_get_sum_inst' , func_door_control_get_sum_inst
        #print ' func_door_control_get_sum_inst type is : ', type(func_door_control_get_sum_inst)
    def func_door_control_get_sum(self, arg_1, arg_2, res_1):
        #res_1 = func_door_control_get_sum_inst(ctypes.c_int(arg_1), ctypes.c_int(arg_2), ctypes.byref(res_1))
        #var_int = ctypes.c_int(0);
        return self.door_control_dll_inst.door_control_get_sum(ctypes.c_int(arg_1), ctypes.c_int(arg_2), ctypes.byref(ctypes.c_int(res_1)))
    def func_door_control_init(self):
        #print 'door_control_dll_inst', door_control_dll_inst
        #door_control_dll_inst = ctypes.windll.Door_control_dll
        self.door_control_dll_inst = ctypes.windll.Door_control_dll
        print ' door_control_dll_inst is ', self.door_control_dll_inst
        return self.door_control_dll_inst.door_control_init()
        pass
    def func_door_control_ser_set_name(self, inp_name):
        return self.door_control_dll_inst.door_control_ser_set_name(ctypes.c_char_p(inp_name))
        pass
    def func_door_control_dev_open(self):
        return self.door_control_dll_inst.door_control_dev_open()
        pass
    def func_door_control_lock_set(self, inp_state):
        return self.door_control_dll_inst.door_control_lock_set(ctypes.c_int(inp_state))
        pass
    def func_door_control_inps_get(self):
        return self.door_control_dll_inst.door_control_inps_get()
        pass
    def func_door_control_modem_reset(self):
        return self.door_control_dll_inst.door_control_modem_reset()
        pass
    def func_door_control_finish(self):
        ret_val = self.door_control_dll_inst.door_control_finish()
        del self.door_control_dll_inst
        return ret_val
        pass
